package com.aaa.dao;

import com.aaa.pojo.Change;
import com.aaa.pojo.Pay_Money;
import com.aaa.pojo.Product_type;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface Pay_MoneyMapper {
    @Select("select * from pay_money m,product_type t,investment_horizon h WHERE m.pro_id=t.pro_id and m.h_id=h.h_id ORDER BY pay_id")
    List<Pay_Money> selectPay_Money();

    @Insert("insert into pay_money(pro_id,pay_amount,pay_rate,h_id) VALUES (#{pro_id},#{pay_amount},#{pay_rate},#{h_id})")
    boolean insertPay_Money(Pay_Money pay_money);


    @Update("update pay_money p,investment_horizon h SET p.pro_id=#{pro_id},p.pay_amount=#{pay_amount},p.pay_rate=#{pay_rate},h.h_deadline=#{h_deadline},h.h_day=#{h_day} WHERE p.pay_id=#{pay_id} and p.h_id=h.h_id")
    boolean updatePay_Money(Pay_Money pay_money);

    //根据id进行查询
    @Select("select * from pay_money m,product_type t,investment_horizon h WHERE m.pro_id=t.pro_id and m.h_id=h.h_id and m.pay_id=#{pay_id}")
    Pay_Money selectById(Integer pay_id);

    @Select("select * from product_type")
    List<Product_type> selectProdcut_type();

    @Delete("DELETE from pay_money where pay_id = #{pay_id}")
    boolean deletePay_Money(Integer pay_id);
}
